<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8"/>
    <title>Title</title>
    <link rel="stylesheet" th:href="@{/layui/layui.css}"/>
    <link rel="stylesheet" th:href="@{/css/main.css}"/>

    <script th:src="@{/layui/layui.all.js}"></script>
    <script type="text/javascript" th:src="@{/js/jquery-3.2.1.js}"></script>
</head>
<body>
<!--轮播图片-->
<div class="layui-carousel" id="test1">
    <div carousel-item="" >
        <div><img src="image/lun.jpg" width="100%" height="100%"/></div>
        <div><img src="image/lun2.jpg" width="100%" height="100%"/></div>
        <div><img src="image/13.jpg" width="100%" height="120%"/></div>
    </div>
</div>
<script>
    layui.use('carousel', function () {
        var carousel = layui.carousel;
        //建造实例
        carousel.render({
            elem: '#test1'
            , width: '100%' //设置容器宽度
            , arrow: 'none' //始终显示箭头
            , width: '1080px'
            , height: '150px'
            //,anim: 'updown' //切换动画方式
        });
    });
</script>
<fieldset class="layui-elem-field layui-field-title" >
    <legend><span class="" style="font-size: 14px">
          <a href="/dor/indexdemo">首页<span class="layui-box">&gt;</span></a>
  <a href="">学生管理<span class="layui-box">&gt;</span></a>
  <a href="">批量增加<span class="layui-box">&gt;</span></a>
</span>
    </legend>
</fieldset>

<!--<form id="uploadFile" class="layui-form">
    <input  type="file" name="file" />
    <input type="button" id="uploadBtn" class="layui-btn layui-btn-normal" value="上传文件" />

</form>-->
<form id="uploadFile" class="layui-form">
    <div style="float:left;position: relative;background-color: #1E9FFF;width: 80px;height: 37px;text-align: center;color: white;line-height: 37px;margin-right: 10px;">
        选择文件
        <input id="file"  type="file" name="file" style="position:absolute;right: 0;top: 0;opacity:0;" />
    </div>
    <span id="filename"></span>
    <input type="button" id="uploadBtn" class="layui-btn layui-btn-normal" value="上传文件" />
</form>



<script>
    $('#uploadBtn').click(function () {
        var file = new FormData($('#uploadFile')[0]);
        $.ajax({
            url : '/dor/uploadFile',
            type : 'post',
            data : file,
            async: false,
            cache: false,
            contentType: false,
            processData: false,
            success: function (data) {
                if (data) {
                    layer.alert('上传成功');
                }
            },
            error: function (data) {
                layer.alert('上传失败')
            }
        });
    })
    $('#file').change(function () {
        var file = $('#file')[0].files[0].name;
        $('#filename').html(file);
    })

</script>

</body>
</html>